package org.huanletao.ssm.model;

/**
 * <p>
 * </p>
 * package: org.huanletao.ssm.model
 * description:
 * className: RespBean
 * author:  踏雪无痕
 * copyright: Copyright (c) 2022/8/28 16:21
 * since: 1.0.0
 */
public class RespBean<T> {
    private String message;
    private String code;
    private T data;

    private RespBean() {
    }

    public static<T> RespBean<T> ok(String message,T data){
        RespBean<T> respBean = new RespBean<T>();
        respBean.setData(data);
        respBean.setCode("00000");
        respBean.setMessage(message);
        return respBean;
    }

    public static<T> RespBean<T> ok(String message){
        RespBean<T> respBean = new RespBean<T>();
        respBean.setMessage(message);
        respBean.setCode("00000");
        return respBean;
    }

    public static<T> RespBean<T> fail(String message,String code){
        RespBean<T> tRespBean = new RespBean<>();
        tRespBean.setMessage(message);
        tRespBean.setCode(code);
        return tRespBean;
    }


    public String getMessage() {
        return message;
    }

    public RespBean<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public String getCode() {
        return code;
    }

    public RespBean<T> setCode(String code) {
        this.code = code;
        return this;
    }

    public T getData() {
        return data;
    }

    public RespBean<T> setData(T data) {
        this.data = data;
        return this;
    }
}
